def total(n):
    """
    计算前 n 项之和
    :param n: 第 n 项
    :return: 前 n 项之和
    """
    if n == 1:
        return 1
    else:
        total_n_1 = total(n - 1)
        print(f'n = {n}')
        print(f'total_n-1 = {total_n_1}')
        return total_n_1 + n


if __name__ == '__main__':
    print(total(100))
